package com.blb.mapper;

import com.blb.entity.Printer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author HuaHao
 * @since 2019-11-14
 */
public interface PrinterMapper extends BaseMapper<Printer> {
    /**
     * 查看所有的打印机名称
     * @return
     */
    @Select("select p_num from t_printer where company_id = #{companyId}")
    List<String> findAllPrinterName(String companyId);

    /**
     * 根据编号进行查询
     */
    List<Printer> findbynum(@Param("start") int start, @Param("length") int length, @Param("num") String num,@Param("companyId") String companyId);

    int count(@Param("num") String num, @Param("companyId") String companyId );

    /**
     * .
     * 添加打印机
     *
     * @param printer
     */
    void addPrinter(Printer printer);

    /**
     * 删除打印机
     *
     * @param id
      */
     @Select("delete from t_printer where id = #{id}")
      void deletePrinter(String id);

    /**
     * 通过id查询打印机
     * @param id
     * @return
     */
     @Select("select * from t_printer where id = #{id}")
    Printer findbyid(String id);

    /**
     * 更新
     *
     * @param printer
     */
    void updatePrinter(Printer printer);

    @Select("select * from t_printer  where company_id = #{companyId} and p_num = #{pNum}")
    Printer getname(@Param("companyId") String companyId , @Param("pNum") String pNum);
}
